package com.demo.enums;

/**
 *
 */
public enum PreventiveRiskRankEnum {
    // 外科
    CAPRINI_JI_DI(4, "极低"),
    CAPRINI_DI_WEI(1, "低危"),
    CAPRINI_ZHONG_WEI(3, "中危"),
    CAPRINI_GAO_WEI(2, "高危"),
    // 内科
    PADUA_DI_WEI(1, "低危"),
    PADUA_GAO_WEI(2, "高危"),

    // 用于查找不到时候返回避免空指针
    UNKNOWN(0, "未知");

    private int value;
    private String desc;

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    PreventiveRiskRankEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static PreventiveRiskRankEnum getByValue(Integer value) {
        for (PreventiveRiskRankEnum item : values()) {
            if (item.getValue() == value) {
                return item;
            }
        }
        return UNKNOWN;
    }
}
